diego.efuture
(usa Mandriva)
Enviado em 13/02/2009 - 09:21h
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
iptables -t nat -F
iptables -X
iptables -Z
iptables -t nat -A POSTROUTING -o $INTER -j MASQUERADE
echo "Firewall - Desativado... Mascaramento completo."
# ELSE - Se o parametro != flush
else
echo "Firewall iptables starting..."
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -F
iptables -t nat -F
iptables -X
iptables -Z
# ========================= *** ======================
#Liberacao do loopback
iptables -A INPUT -i lo -j ACCEPT
# SSH - Para mim impressindivel Obs: comente esta linha para nao aceitar ssh
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# Webmin - Acesso externo ao WEBMIN
iptables -A INPUT -p tcp --dport 666 -j ACCEPT
########################### FTP ##########################
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 21 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 21 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 21 -j ACCEPT
#################### CAMERAS DE SEGURANÇA #################
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 2000 -j DNAT --to-destination 192.168.1.252
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 2000 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 2000 -j ACCEPT
################### WEBMAIL - EXCHANGE ###################
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 443 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 443 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 443 -j ACCEPT
#################### MANUTENÇÃO REMOTA ####################
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 3389 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 3389 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 3389 -j ACCEPT
##################### POP - EXCHANGE ######################
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 25 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 25 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 25 -j ACCEPT
##################### SMTP - EXCHANGE ######################
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 110 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 110 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 110 -j ACCEPT
############################### SOPHIA #######################################
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 8099 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 8099 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 8099 -j ACCEPT
###################### SERVIDOR DE RELATORIOS SOPHIA ###########################
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 9002 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 9002 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 9002 -j ACCEPT
####################### BORLAND SOCKET SERVER - SOPHIA ###############################
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 211 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 211 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 211 -j ACCEPT
#################### HTTP - SERVER CAMERAS DE SEG #################
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 80 -j DNAT --to-destination 192.168.1.254
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 80 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 4550 -j DNAT --to-destination 192.168.1.252
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 4550 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 4550 -j ACCEPT
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 5550 -j DNAT --to-destination 192.168.1.252
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 5550 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 5550 -j ACCEPT
iptables -t nat -A PREROUTING -i $INTER -p tcp --dport 3550 -j DNAT --to-destination 192.168.1.252
iptables -t nat -A POSTROUTING -o $INTRA -p tcp --dport 3550 -j SNAT --to-source 192.168.1.1
iptables -A FORWARD -p tcp --dport 3550 -j ACCEPT
# ======== *** =========
# LAN ---> FIREWALL
# Setaremos as portas que poderemos acessar via rede local no servidor
# SQUID - Utilizo servidor proxy squid na porta 3128
iptables -A INPUT -p tcp -s $LAN --dport 3128 -j ACCEPT
# NETBIOS - Estas 3 portas sao usadas pelo protocolo de compartilhamento
# de arquivos em redes Microsoft. Cada uma das portas tem uma funcao especial
# (nome, datagrama e sessao) mas e' necessario que as 3 estejam abertas no
# firewall para que a visualizacoes dos compartilhamentos e acesso aos
# arquivos funcione corretamente
iptables -A INPUT -p tcp -s $LAN --dport 137:139 -j ACCEPT
iptables -A INPUT -p udp -s $LAN --dport 137:139 -j ACCEPT
# DNS - Libera a resolucao de nomes
iptables -A INPUT -p tcp -s $LAN --dport 53 -j ACCEPT
iptables -A INPUT -p udp -s $LAN --dport 53 -j ACCEPT
#======== *** =========
# LAN ---> INTERNET
# LAN ---> FIREWALL
# Setaremos as portas que poderemos acessar via rede local no servidor
# SQUID - Utilizo servidor proxy squid na porta 3128
iptables -A INPUT -p tcp -s $LAN --dport 3128 -j ACCEPT
# NETBIOS - Estas 3 portas sao usadas pelo protocolo de compartilhamento
# de arquivos em redes Microsoft. Cada uma das portas tem uma funcao especial
# (nome, datagrama e sessao) mas e' necessario que as 3 estejam abertas no
# firewall para que a visualizacoes dos compartilhamentos e acesso aos
# arquivos funcione corretamente
iptables -A INPUT -p tcp -s $LAN --dport 137:139 -j ACCEPT
iptables -A INPUT -p udp -s $LAN --dport 137:139 -j ACCEPT
# DNS - Libera a resolucao de nomes
iptables -A INPUT -p tcp -s $LAN --dport 53 -j ACCEPT
iptables -A INPUT -p udp -s $LAN --dport 53 -j ACCEPT
#======== *** =========
# LAN ---> INTERNET